Method and apparatus for coefficient scan based on partition mode of prediction unit

ABSTRACT

Provided are a method and an apparatus for coefficient scan on the base of a partition mode of a prediction unit. The method comprises the steps of: determining a scan method on the basis of a partition mode of a prediction unit; and encoding the information about the scan method, wherein the scan method is determined, on the basis of RDO (Rate Distortion optimization), from among the extracted candidate scan methods which have been extracted with consideration of the shapes of the partitions of the partition mode.

CROSS REFERENCE TO RELATED APPLICATIONS

The application is a Continuation of U.S. patent application Ser. No.15/015,178 (filed on Feb. 4, 2016), which is a Continuation of U.S.patent application Ser. No. 14/605,351 (filed on Jan. 26, 2015), nowissued as U.S. Pat. No. 9,294,773, which is a Continuation of U.S.patent application Ser. No. 14/356,788 (filed on May 7, 2014), nowissued as U.S. Pat. No. 9,225,990, which is a National Stage PatentApplication of PCT International Patent Application No.PCT/KR2012/009373 (filed on Nov. 8, 2012) under 35 U.S.C. §371, whichclaims priority to Korean Patent Application Nos. 10-2011-0116126 (filedon Nov. 8, 2011) and 10-2012-0125799 (filed on Nov. 8, 2012), theteachings of which are incorporated herein in their entireties byreference.

TECHNICAL FIELD

The present invention relates to video encoding and decoding, and moreparticularly, to a method and an apparatus for determining a scan methodbased on a partition mode of a prediction unit and encoding/decodinginformation thereof.

BACKGROUND ART

Recently, demands for high-resolution and high-quality videos, such ashigh-definition (HD) and ultrahigh-definition (UHD) videos, areincreasing in various fields of applications. As video data has higherresolution and higher quality, the amount of data more increasesrelative to existing usual video data. Accordingly, when video data istransferred using media such as existing wired and wireless broad bandlines or is stored in existing storage media, transfer cost and storagecost increase. In order to solve these problems occurring with anincrease in resolution and quality of video data, high-efficiency videocompression techniques may be utilized.

Video compression technology includes various techniques, such as aninter prediction technique of predicting pixel values included in acurrent picture from previous or subsequent pictures of the currentpicture, an intra prediction technique of predicting pixel valuesincluded in a current picture using pixel information in the currentpicture, and an entropy encoding technique of assigning a short code toa value with a high appearance frequency and assigning a long code to avalue with a low appearance frequency. Video data may be effectivelycompressed and transferred or stored using such video compressiontechniques.

DISCLOSURE Technical Problem

An aspect of the present invention is to provide a method of determininga scan method based on a partition mode of a prediction unit forimproving video encoding/decoding efficiency and encoding/decoding thescan method.

Another aspect of the present invention is to provide an apparatus fordetermining a scan method based on a partition mode of a prediction unitfor improving video encoding/decoding efficiency and encoding/decodingthe scan method.

Technical Solution

An embodiment of the present invention provides a video encoding method.The method includes determining a scanning method based on a partitionmode of a prediction unit, and encoding information on the scanningmethod, wherein the scanning method is determined based onrate-distortion optimization (RDO) among candidate scanning methodsderived in view of a partition shape of the partition mode.

The determining of the scanning method may derive horizontal scanningand zigzag scanning as the candidate scanning methods when the partitionmode has a vertically oriented partition shape and derive verticalscanning and zigzag scanning as the candidate scanning methods when thepartition mode has a horizontally oriented partition shape.

The partition mode may include an N×2N mode, a 2N×N mode, a 2N×2N mode,an N×N mode, a 2N×nU mode, a 2N×nD mode, an nL×2N mode and an nR×2N modebased on a size of the prediction unit for which inter prediction hasbeen performed.

The partition mode having the vertically oriented partition shape mayinclude the N×2N mode, the nL×2N mode and the nR×2N mode, wherein thepartition mode having the vertically oriented partition shape is a ½N×2Nmode of a left partition with a smaller partition size for the nL×2Nmode and the partition mode having the vertically oriented partitionshape is a ½N×2N mode of a right partition with a smaller partition sizefor the nR×2N mode.

The partition mode having the horizontally oriented partition shape mayinclude the 2N×N mode, the 2N×nU mode and the 2N×nD mode, wherein thepartition mode having the horizontally oriented partition shape is a2N×½N mode of an upper partition with a smaller partition size for the2N×nU mode and the partition mode having the horizontally orientedpartition shape is es a 2N×½N mode of a lower partition with a smallerpartition size for the 2N×nD mode.

The determining of the scanning method may determine zigzag scanning asthe scanning method when the partition mode is the 2N×2N mode, the N×Nmode, a 3/2N×2N mode of a right partition with a larger partition sizein the nL×2N mode, a 3/2N×2N mode of a left partition with a largerpartition size in the nR×2N mode, a 2N×3/2N mode of a lower partitionwith a larger partition size in the 2N×nU mode or a 2N×3/2N mode of anupper partition with a larger partition size in the 2N×nD mode.

The information on the scanning method may be indicated using a flag,and the flag may indicate whether zigzag scanning is used.

Another embodiment of the present invention provides a video encodingmethod. The method includes determining a scanning method based on apartition mode of a prediction unit for which short distance intraprediction (SDIP) has been performed, and encoding information on thescanning method, wherein the scanning method is determined based on RDOamong candidate scanning methods derived in view of a partition shape ofthe partition mode.

The determining of the scanning method may derive horizontal scanningand zigzag scanning as the candidate scanning methods when the partitionmode has a vertically oriented partition shape and derive verticalscanning and zigzag scanning as the candidate scanning methods when thepartition mode has a horizontally oriented partition shape.

The partition mode may include a ½N×2N mode, a 2N×½N mode, an N×N modeand a 2N×2N mode based on a size of the prediction unit for which SDIPhas been performed.

The partition mode having the vertically oriented partition shape mayinclude is the ½N×2N mode, and the partition mode having thehorizontally oriented partition shape may include the 2N×½N mode.

The determining of the scanning method may determine zigzag scanning asthe scanning method when the partition mode is the N×N mode or the 2N×2Nmode.

The information on the scanning method may be indicated using a flag,and the flag may indicate whether zigzag scanning is used.

Still another embodiment of the present invention provides a videoencoding method. The method includes determining a scanning method basedon a partition mode of a prediction unit, and inverse-scanning atransform coefficient according to the scanning method, wherein thescanning method is determined based on the partition mode usinginformation signaled from an encoding apparatus, and the signaledinformation is a flag indicates whether zigzag scanning is used.

The determining of the scanning method may decode the flag indicatingwhether zigzag scanning is used and determine the scanning method basedon a value of the decoded flag when the partition mode has a verticallyoriented partition shape or horizontally oriented partition shape, inwhich one of zigzag scanning and horizontal scanning may be selectedbased on the value of the decoded flag when the partition mode is thevertically oriented partition shape, and one of zigzag scanning andvertical scanning may be selected based on the value of the decoded flagwhen the partition mode has the horizontally oriented partition shape.

The partition mode may include an N×2N mode, a 2N×N mode, a 2N×2N mode,an N×N mode, a 2N×nU mode, a 2N×nD mode, an nL×2N mode and an nR×2N modebased on a size of the prediction unit for which inter prediction isperformed.

the partition mode having the vertically oriented partition shapecomprises the N×2N mode, the nL×2N mode and the nR×2N mode, wherein thepartition mode having the vertically oriented partition shape is a ½N×2Nmode of a left partition with a smaller partition size for the nL×2Nmode and the partition mode having the vertically oriented partitionshape is a ½N×2N mode of a right partition with a smaller partition sizefor the nR×2N mode, and wherein the partition mode having thehorizontally oriented partition shape comprises the 2N×N mode, the 2N×nUmode and the 2N×nD mode, wherein s the partition mode having thehorizontally oriented partition shape is a 2N×½N mode of an upperpartition with a smaller partition size for the 2N×nU mode and thepartition mode having the horizontally oriented partition shape is a2N×½N mode of a lower partition with a smaller partition size for the2N×nD mode

The determining of the scanning method may determine zigzag scanning asthe scanning method when the partition mode is the 2N×2N mode, the N×Nmode, a 3/2N×2N mode of a right partition with a larger partition sizein the nL×2N mode, a 3/2N×2N mode of a left partition with a largerpartition size in the nR×2N mode, a 2N×3/2N mode of a lower partitionwith a larger partition size in the 2N×nU mode or a 2N×3/2N mode of anupper partition with a larger partition size in the 2N×nD mode.

The partition mode may include a ½N×2N mode, a 2N×½N mode, an N×N modeand a 2N×2N mode based on a size of the prediction unit in SDIP, thepartition mode having the vertically oriented partition shape includingis the ½N×2N mode and the partition mode having the horizontallyoriented partition shape including the 2N×½N mode.

The determining of the scanning method may determine zigzag scanning asthe scanning method when the partition mode is the N×N mode or the 2N×2Nmode.

Advantageous Effects

According to the present invention, a scanning method for transformcoefficients is determined using a partition mode of a prediction unit,that is, particular directivity or particular texture of the predictionunit, thereby increasing efficiency in encoding and decoding.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a video encoding apparatusaccording to an exemplary embodiment of the present invention.

FIG. 2 is a block diagram illustrating a video decoding apparatusaccording to an exemplary embodiment of the present invention.

FIG. 3 schematically illustrates a coefficient scanning method accordingto the present invention.

FIG. 4 illustrates a method of determining and encoding a scanningmethod based on a partition mode of a prediction unit according to anexemplary embodiment of the present invention.

FIG. 5 illustrates a method of determining and encoding a scanningmethod in asymmetric motion partition (AMP) according to an exemplaryembodiment of the present invention.

FIG. 6 illustrates a method of determining and encoding a scanningmethod in short distance intra prediction (SDIP) according to anexemplary embodiment of the present invention.

FIG. 7 is a flowchart illustrating a video encoding process according tothe present invention.

FIG. 8 is a flowchart illustrating a video decoding process according tothe present invention.

MODE FOR INVENTION

The present invention may be changed and modified variously and beillustrated with reference to different exemplary embodiments, some ofwhich will be described and shown in the drawings. However, theseembodiments are not intended for limiting the invention but areconstrued as including includes all modifications, equivalents andreplacements which belong to the spirit and technical scope of theinvention. Like reference numerals in the drawings refer to likeelements throughout.

Although the terms first, second, etc. may be used to describe variouselements, these elements should not be limited by these terms. Theseterms are used only to distinguish one element from another element. Forexample, a first element could be termed a second element and a secondelement could be termed a first element likewise without departing fromthe teachings of the present invention. The term “and/or” includes anyand all combinations of a plurality of associated listed items.

It will be understood that when an element is referred to as being“connected to” or “coupled to” another element, the element can bedirectly connected or coupled to another element or interveningelements. On the contrary, when an element is referred to as being“directly connected to” or “directly coupled to” another element, thereare no intervening elements present.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a,” “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “include” and/or“have,” when used in this specification, specify the presence of statedfeatures, integers, steps, operations, elements, and/or components, butdo not preclude the presence or addition of one or more other features,integers, steps, operations, elements, components, and/or groupsthereof.

Hereinafter, exemplary embodiments of the invention will be described indetail with reference to the accompanying drawings. Like referencenumerals in the drawings refer to like elements throughout, andredundant descriptions of like elements will be omitted herein.

FIG. 1 is a block diagram illustrating a video encoding apparatusaccording to an exemplary embodiment of the present invention.

Referring to FIG. 1, the video encoding apparatus 100 includes a picturepartition module 110, prediction modules 120 and 125, a transform module130, a quantization module 135, a rearrangement module 160, an entropyencoding module 165, a dequantization module 140, an inverse transformmodule 145, a filter module 150 and a memory 155.

Although elements illustrated in FIG. 1 are independently shown so as torepresent different distinctive functions in the video encodingapparatus, such a configuration does not indicate that each element isconstructed by a separate hardware constituent or software constituent.That is, the elements are independently arranged for convenience ofdescription, wherein at least two elements may be combined into a singleelement, or a single element may be divided into a plurality of elementsto perform functions. It is to be noted that embodiments in which someelements are integrated into one combined element and/or an element isdivided into multiple separate elements are included in the scope of thepresent invention without departing from the essence of the presentinvention.

Some elements are not essential to the substantial functions in theinvention and may be optional constituents for merely improvingperformance. The invention may be embodied by including onlyconstituents essential to embodiment of the invention, except forconstituents used to merely improve performance. The structure includingonly the essential constituents except for the optical constituents usedto merely improve performance belongs to the scope of the invention.

The picture partition module 110 may partition an input picture into atleast one process unit. Here, the process unit may be a prediction unit(PU), a transform unit (TU) or a coding unit (CU). The picture partitionmodule 110 may partition one picture into a plurality of combinations ofCUs, PUs and TUs and select one combination of CUs, PUs and TUs on thebasis of a predetermined criterion (for example, a cost function),thereby encoding the picture.

For example, one picture may be partitioned into a plurality of CUs. Arecursive tree structure, such as a quad tree structure, may be used topartition a picture into CUs. A CU, for which a picture or a CU of amaximum size may be as root, may be partitioned into sub-coding unitswith as many child nodes as the partitioned CUs. A CU which is notpartitioned any more in accordance with a predetermined limitation is aleaf node. That is, assuming that a CU may be partitioned into quadrantsonly, a single CU may be partitioned into at most four different CUs.

In the embodiments of the invention, a CU may be used to refer to notonly a unit of encoding but also a unit of decoding.

A PU may be partitioned into at least one square or rectangular formwith the same size in a CU. For PUs partitioned from a same CU, a PU mayhave different shape from other PUs.

When a PU for intra prediction is generated based on a CU and the CU isnot a minimum CU, the CU may be subjected to intra prediction withoutbeing partitioned into plural PUs (N×N).

The prediction modules 120 and 125 may include an inter predictionmodule 120 to perform inter prediction and an intra prediction module125 to perform intra prediction. The prediction modules 120 and 125 maydetermine which of inter prediction and intra prediction should beperformed on a PU, and may determine specific information (for example,an intra prediction mode, a motion vector, and a reference picture) ofthe determined prediction method. Here, a process unit on whichprediction is performed may be different from a process unit for which aprediction method and specific information thereon are determined. Forexample, a prediction method and a prediction mode may be determined foreach PU, while prediction may be performed for each TU. A residual value(residual block) between a generated predicted block and an originalblock may be input to the transform module 130. Further, prediction modeinformation, motion vector information and the like used for predictionmay be encoded along with the residual value by the entropy encodingmodule 165 and be transmitted to the decoding apparatus. When a specificencoding mode is used, the original block may be encoded and transmittedto the decoding apparatus without generating a prediction block by theprediction modules 120 and 125.

The inter prediction module 120 may predict a PU on the basis ofinformation on at least one picture among a previous picture of acurrent picture and a subsequent picture of a current picture. The interprediction module 120 may include a reference picture interpolationmodule, a motion prediction module, and a motion compensation module.

The reference picture interpolation module may be supplied withreference picture information from the memory 155 and generate pixelinformation less than an integer pixel from a reference picture. In thecase of luma pixels, a DCT-based 8-tap interpolation filter with avariable filter coefficient may be used to generate information on apixel smaller than an integer pixel in a unit of a ¼ pixel. In the caseof chroma pixels, a DCT-based 4-tap interpolation filter with a variablefilter coefficient may be used to generate information on a pixelsmaller than an integer pixel in a unit of a ⅛ pixel.

The motion prediction module may perform motion prediction on the basisof the reference picture interpolated by the reference pictureinterpolation module. Various methods, such as a full search-based blockmatching algorithm (FBMA), a three-step search (TSS) algorithm and a newthree-step search (NTS) algorithm, may be used to calculate a motionvector. A motion vector has a motion vector value in the unit of a ½ or¼ pixel on the basis of an interpolated pixel. The motion predictionmodule may predict a current PU using different motion predictionmethods. Various methods, such as skip mode, merge mode, and advancedmotion vector prediction (AMVP), etc. may be used as the motionprediction method.

The intra prediction module 125 may generate a PU on the basis ofinformation on a reference pixel neighboring to a current block. Theinformation on a reference pixel neighboring to the current block ispixel information in a current picture. When a reference pixel is apixel for which inter prediction has been performed because a block,which includes the reference pixel, neighboring to the current PU is ablock for which inter prediction has been performed, information on areference pixel included in the block for which inter prediction hasbeen performed may be replaced with information on a reference pixel ina block for which intra prediction has been performed. That is, when areference pixel is not available, information on the unavailablereference pixel may be replaced with information on at least onereference pixel of the available reference pixels.

A prediction mode of intra prediction includes a directional predictionmode in which reference pixel information is used according to aprediction direction and a non-directional prediction mode in whichinformation on direction is not used in performing prediction. A modefor predicting luma information and a mode for predicting chromainformation may be different from each other. Further, intra predictionmode information used to obtain luma information or predicted lumasignal information may be used to predict chroma information.

If a PU and a TU have the same size when intra prediction is performed,intra prediction on the PU may be performed based on left pixels, anupper-left pixel and upper pixels of the PU. On the other hand, if a PUand a TU have different sizes when intra prediction is performed, intraprediction may be performed using reference pixels based on the TU.Intra prediction using N×N partitioning may be performed only for aminimum CU.

In the intra prediction method, a predicted block may be generatedaccording to the prediction mode after an adaptive intra smoothing (AIS)filter being applied. Different types of AIS filters may be applied tothe reference pixels. In the intra prediction method, the intraprediction mode of a current PU may be predicted from an intraprediction mode of a PU neighboring to the current PU. In predicting theprediction mode of the current PU using mode information predicted froma neighboring PU, when the current PU and the neighboring PU have thesame intra prediction mode, information indicating that the current PUand the neighboring PU have the same prediction mode may be transmittedusing predetermined flag information. When the current PU and theneighboring PU have different prediction modes, information on theprediction mode of the current block may be encoded by entropy encoding.

A residual block including residual information which is a differencebetween the original block of the PU and the predicted block of a PUgenerated based on the PU generated by the prediction modules 120 and125, may be generated. The generated residual block may be input to thetransform module 130.

The transform module 130 may transform the residual block using atransform method such as Discrete Cosine Transform (DCT) or DiscreteSine Transform (DST). The residual block includes information on theresidual between the PU generated by the prediction modules 120 and 125and the original block. A transform method to be used to transform theresidual block may be determined among DCT and DST on the basis of theinformation on the intra prediction mode applied to the PU which is usedto generate the residual block.

The quantization module 135 may quantize values transformed into afrequency domain by the transform module 130. A quantization coefficientmay change depending on a block or importance of a picture. Valuesoutput from the quantization module 135 may be provided to thedequantization module 140 and the rearrangement module 160.

The rearrangement module 160 may rearrange coefficients with respect toquantized residual values.

The rearrangement module 160 may change a two-dimensional (2D) block ofcoefficients into a one-dimensional (1D) vector of coefficients throughcoefficient scanning. For example, the rearrangement module 125 maychange a 2D block of coefficients into a 1D vector of coefficients byscanning from DC coefficients to coefficients of a high frequency domainusing zigzag scanning. Vertical scanning for scanning a 2D block ofcoefficients in a vertical direction and horizontal scanning forscanning a 2D block of coefficients in a horizontal direction may beused depending on a size of a TU and an intra prediction mode, insteadof zigzag scanning. That is, a scanning method for use may be selectedbased on the size of the TU and the intra prediction mode among zigzagscanning, vertical scanning, and horizontal scanning.

The entropy encoding module 165 may perform entropy encoding on thebasis of the values obtained by the rearrangement module 160. Variousencoding methods, such as exponential Golomb coding, context-adaptivevariable length coding (CAVLC), or context-adaptive binary arithmeticcoding (CABAC), may be used for entropy encoding.

The entropy encoding module 165 may encode a variety of information,such as residual coefficient information and block type information on aCU, prediction mode information, partitioning unit information, PUinformation, transfer unit information, motion vector information,reference frame information, block interpolation information andfiltering information from the rearrangement module 160 and theprediction modules 120 and 125.

The entropy encoding module 165 may entropy-encode coefficients of a CUinput from the rearrangement module 160.

The dequantization module 140 and the inverse transform module 145dequantize the values which are quantized by the quantization module 135and inversely transform the values which are transformed by thetransform module 130. The residual values generated by thedequantization module 140 and the inverse transform module 145 may beadded to the predicted PU. The predicted PU may be predicted by themotion vector prediction module, the motion compensation module, and theintra prediction module of the prediction modules 120 and 125. Areconstructed block may be generated by adding the residual values tothe predicted PU (predicted values).

The filter module 150 may include at least one of a deblocking filter,an offset module, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion generated onboundaries between blocks in a reconstructed picture. Whether to applythe deblocking filter to a current block may be determined on the basisof pixels included in several rows or columns of the block. When thedeblocking filter is applied to a block, a strong filter or a weakfilter may be applied depending on a required deblocking filteringstrength. When horizontal filtering and vertical filtering are performedin applying the deblocking filter, the horizontal filtering and verticalfiltering may be performed in parallel.

The offset module may apply an offset form the original picture in theunit of a pixel to the picture for which the deblocking filteringprocess is completed. A region to which the offset may be applied may bedetermined after partitioning pixels of a picture into a predeterminednumber of regions. The offset may be applied to the determined area inconsideration of edge information on each pixel and the method ofapplying the offset to the determined area.

The ALF may perform filtering based on a comparison result of thefiltered reconstructed picture and the original picture. Pixels includedin a picture may be partitioned into predetermined groups, a filter tobe applied to each group may be determined, and differential filteringmay be performed for each group. Information on whether to apply the ALFmay be transferred by each coding unit (CU) and a size and coefficientof an ALF to be applied to each block may vary. The ALF may have varioustypes and a number of coefficients included in a corresponding filtermay vary. Further, an ALF filter with the same form (fixed form) may beapplied to a block regardless of characteristics of the block.

The memory 155 may store a reconstructed block or picture output fromthe filter module 150, and the stored reconstructed block or picture maybe supplied to the prediction modules 120 and 125 when performing interprediction.

FIG. 2 is a block diagram illustrating a video decoding apparatusaccording an exemplary embodiment of the present invention.

Referring to FIG. 2, the video decoding apparatus 200 may include anentropy decoding module 210, a rearrangement module 215, adequantization module 220, an inverse transform module 225, predictionmodules 230 and 235, a filter module 240, and a memory 245.

When a video bitstream is input from the video encoding apparatus, theinput bitstream may be decoded according to an inverse process of thevideo encoding process performed in the video encoding apparatus.

The entropy decoding module 210 may perform entropy decoding accordingto an inverse process of the entropy encoding process by the entropyencoding module of the video encoding apparatus. For example, variousmethods, such as exponential Golomb coding, CAVLC or CABAC, may be usedfor entropy encoding, corresponding to the method used by the videoencoding apparatus.

The entropy decoding module 210 may decode information associated withintra prediction and inter prediction performed by the encodingapparatus.

The rearrangement module 215 may perform rearrangement on the bit streamentropy-decoded by the entropy decoding module 210 on the basis of therearrangement method of the encoding module. The rearrangement module215 may reconstruct and rearrange coefficients in a 1D vector form intocoefficients in a 2D block. The rearrangement module 215 may be providedwith information on coefficient scanning performed by the encodingapparatus and may perform rearrangement using a method of inverselyscanning the coefficients on the basis of scanning order in whichscanning is performed by the encoding apparatus.

The dequantization module 220 may perform dequantization on the basis ofa quantization parameter provided from the encoding apparatus and therearranged coefficients of the block.

The inverse transform module 225 may perform inverse DCT and inverse DSTon a result of quantization performed by the video encoding apparatus,having been subjected to DCT and DST performed by the transform module.Inverse transform may be performed on the basis of a transfer unitdetermined by the video encoding apparatus. The transform module of thevideo encoding apparatus may selectively perform DCT and DST dependingon a plurality of information elements, such as a prediction method, asize of the current block and a prediction direction, etc. and theinverse transform module 225 of the video decoding apparatus may performinverse transform on the basis of information on the transform performedby the transform module of the video encoding apparatus.

The prediction modules 230 and 235 may generate a prediction block(predicted block) on the basis of prediction block generationinformation supplied from the entropy decoding module 210 andinformation on a previously-decoded block or picture provided from thememory 245.

Similarly to the operation of the video encoding apparatus as describedabove, if a PU and a TU have the same size when intra prediction isperformed, intra prediction on the PU is performed based on left pixels,an upper-left pixel and upper pixels of the PU. On the other hand, if aPU and a TU have different sizes when intra prediction is performed,intra prediction may be performed using reference pixels based on theTU. Intra prediction using N×N partitioning may be used only for aminimum CU.

The prediction modules 230 and 235 may include a PU determinationmodule, an inter prediction module and an intra prediction module. ThePU determination module may receive a variety of information, such as PUinformation, prediction mode information on an intra prediction methodand motion prediction-related information on an inter prediction method,etc. from the entropy decoding module 210, may determine a PU for acurrent CU. The PU determination module may determine which of the interprediction and the intra prediction is performed on the PU. An interprediction module 230 may perform inter prediction on a current PU onthe basis of information on at least one picture among a previouspicture and a subsequent picture of a current picture including thecurrent PU. An inter prediction module 230 may use information necessaryfor inter prediction for the current PU provided from the video encodingapparatus.

In order to perform inter prediction, it may be determined on the basisof a CU whether a motion prediction method for a PU included in the CUis a skip mode, a merge mode or an AMVP mode.

An intra prediction module 235 may generate a prediction block on thebasis of pixel information in a current picture. When a PU is a PU forwhich intra prediction is performed, intra prediction may be performedbased on intra prediction mode information on the PU provided from thevideo encoding apparatus. The intra prediction module 235 may include anAIS filter, a reference pixel interpolation module, and a DC filter. TheMS filter performs filtering on reference pixels of a current block. TheAIS filter may decide whether to apply the filter or not depending on aprediction mode for the current PU. AIS filtering may be performed onthe reference pixels of the current block using the prediction mode forthe PU and information on the AIS filter provided from the videoencoding apparatus. When the prediction mode for the current block is amode not performing AIS filtering, the AIS filter may not be applied.

When the prediction mode for the PU is a prediction mode of performingintra prediction on the basis of pixel values obtained by interpolatingthe reference pixels, the reference pixel interpolation module maygenerate reference pixels in a unit of a fractional pixel less than aninteger pixel (i.e. full pixel) by interpolating the reference pixels.When the prediction mode for the current PU is a prediction mode ofgenerating a prediction block without interpolating the referencepixels, the reference pixels may not be interpolated. The DC filter maygenerate a prediction block through filtering when the prediction modefor the current block is the DC mode.

The reconstructed block or picture may be provided to the filter module240. The filter module 240 includes a deblocking filter, an offsetmodule, and an ALF.

The video encoding apparatus mat provide information on whether thedeblocking filter is applied to a corresponding block or picture, andinformation on which of a strong filter and a weak filter is appliedwhen the deblocking filter is used. The deblocking filter of the videodecoding apparatus may be provided with information on the deblockingfilter from the video encoding apparatus and may perform deblockingfiltering on a corresponding block.

The offset module may apply offset to the reconstructed picture on thebasis of information on an offset type and offset value applied to thepicture in the encoding process.

The ALF may be applied to a CU on the basis of information on whetherthe ALF is applied and ALF coefficient information, etc. provided fromthe encoding apparatus. The ALF information may be included and providedin a specific parameter set.

The memory 245 may store the reconstructed picture or block for use as areference picture or a reference block and may provide the reconstructedpicture to an output module.

As described above, in the embodiments of the invention, the term“coding unit” is used as an encoding unit for a convenience ofdescriptions. However, the term “coding unit” may be also used as a unitof decoding.

Hereinafter, scanning methods based on prediction modes and partitionmodes in prediction to be illustrated in FIGS. 3 to 8 according toexemplary embodiments of the present invention may be achieved inaccordance with functions of the modules of the encoding apparatus andthe decoding apparatus described above in FIGS. 1 and 2, which fallwithin the scope of the present invention.

FIG. 3 schematically illustrates coefficient scanning methods accordingto the present invention.

Referring to FIG. 3, the scanning methods may include horizontalscanning 310, vertical scanning 320, and zigzag scanning 330 or uprightdiagonal scanning 340. Here, one of these scanning methods shown in FIG.3 may be used based on a partitioned shape of a PU, and a 2D block ofquantized transform coefficients may be changed into a 1D vector oftransform coefficients by scanning.

Horizontal scanning 310, which scans transform coefficients in ahorizontal direction, may be applied, for example, when a PU is apartition which is a vertically oriented block, such as an N×2N block.The vertically oriented block is highly likely to include a texture of avertical component, in which the transform coefficients are highlylikely to be distributed in the horizontal direction. Thus, a scanningorder shown in the method 310 of FIG. 3 may be applied to scanning thetransform coefficients.

Vertical scanning 320, which scans transform coefficients in a verticaldirection, may be applied, for example, when a PU is a partition whichis a horizontally oriented block, such as a 2N×N block. The horizontallyoriented block is highly likely to include texture of horizontalcomponent, in which the transform coefficients are highly likely to bedistributed in the vertical direction. Thus, a scanning order shown inthe method 320 of FIG. 3 may be applied to scanning the transformcoefficients.

Zigzag scanning 330 or upright diagonal scanning 340 may be applied whena PU do not have particular directivity or particular component oftexture. For example, zigzag scanning 330 or upright diagonal scanning340 may be applied to 2N×2N or N×N square block.

The scanning methods of FIG. 3 are provided for examples of the presentinvention, and the present invention is not limited thereto. Alternativescanning methods performed in different orders may be also used as wellas the scanning methods of FIG. 3.

As described above, when a PU is a partition such as an N×2N block or a2N×N block, these blocks may be highly likely to have particularcomponent of texture or strong directionality. Accordingly horizontalscanning or vertical scanning is used depending on a partition shape ofthe PU. However, even though a PU is a partition such as an N×2N blockor a 2N×N block, these blocks may have insignificant directionality ornot include particular component of texture. In this case, it may not beefficient to use the particular scanning methods, for example,horizontal scanning for an N×2N block and vertical scanning for a 2N×Nblock. Thus, a method of effectively scanning and encoding transformcoefficients is needed.

FIG. 4 illustrates a method of determining a scanning method andencoding information thereon based on a partition mode of a PU accordingto an exemplary embodiment of the present invention.

Referring to FIG. 4, a single CU of an inter prediction mode may bepartitioned into PUs with the same size or different sizes. For example,the CU may be partitioned into 2N×N block 400, N×2N block 410, 2N×2Nblock 420 or N×N block 430. Partition modes PartMode of the PUs may bedetermined based on sizes of the partitioned PUs.

Partition modes PartMode of PUs may include a PART_2N×N mode in which aCU is partitioned into 2N×N 400 blocks, a PART_N×2N mode in which a CUis partitioned into N×2N 410 blocks, a PART_2N×2N mode in which a CU ispartitioned into 2N×2N 420 blocks, and a PART_N×N mode in which a CU ispartitioned into N×N 430 blocks.

In the present embodiment, a scanning method is determined based on apartition mode of a PU, in which a partitioned shape of the partitionmode may be considered. That is, candidate scanning methods may beobtained in view of partitioned shapes of PUs, among which a scanningmethod may be determined based on rate-distortion optimization (RDO).

When the partition mode indicates a horizontally oriented shape, forexample, the partition mode is the PART_2N×N mode in which a CU ispartitioned into 2N×N 400 blocks, the blocks may be likely to haveparticular component of texture or directionality (for example,horizontal component of texture or transform coefficients distributed inthe vertical direction). Vertical scanning may be derived as a candidatescanning method in view of such a partitioned shape. Also, zigzagscanning (or upright diagonal scanning) may be derived as a candidatescanning method considering that the blocks are likely not to haveparticular component of texture or directionality. That is, for thepartition mode of the horizontally oriented shape, a scanning methodhaving minimum RDO may be selected among the two candidate scanningmethods, vertical scanning and zigzag scanning (or upright diagonalscanning).

Alternatively, when the partition mode indicates a vertically orientedshape, for example, the partition mode is the PART_N×2N mode in which aCU is partitioned into N×2N 410 blocks, the blocks may be likely to haveparticular component of texture or directionality (for example, verticalcomponent of texture or transform coefficients distributed in thehorizontal direction). Horizontal scanning may be derived as a candidatescanning method in view of such a partitioned shape. Also, zigzagscanning (or upright diagonal scanning) may be derived as a candidatescanning method considering that the blocks are likely not to haveparticular component of texture or directionality. That is, for thepartition mode of a vertically oriented shape, a scanning method havingminimum RDO may be selected among the two candidate scanning methods,horizontal scanning and zigzag scanning (or upright diagonal scanning).

Meanwhile, for the partition mode of a square shape, for example, thePART_2N×2N mode in which a CU is partitioned into 2N×2N 420 blocks orthe PART_N×N mode in which a CU is partitioned in N×N 430 blocks, zigzagscanning (or upright diagonal scanning) may be used.

Table 1 illustrates available scanning methods according to partitionmodes of PUs according to the exemplary embodiment of the presentinvention. Here, in the PART_2N×N mode and the PART_N×2N mode, onescanning method may be selected in view of RDO from two candidatescanning methods.

TABLE 1 PU Partition mode Scan pattern PART_2N × N Verticalscanning/Zigzag scanning PART_N × 2N Horizontal scanning/Zigzag scanningPART_2N × 2N Zigzag scanning PART_N × N Zigzag scanning

When a scanning method is determined based on a partition mode of a PUas described above, transform coefficients may be scanned using thedetermined scanning method. Information on the determined scanningmethod may be encoded and transmitted to the decoding apparatus. Theinformation on the scanning method may be indicated using a flag, forexample, a flag isZigZagScanFlag indicating whether zigzag scanning isused.

For instance, when the partition mode of the PU is the PART_2N×N mode,information on a determined scanning method of vertical scanning andzigzag scanning (or upright diagonal scanning) may be encoded using aflag, and the flag information may be transmitted to the decodingapparatus. In the PART_2N×N mode, isZigZagScanFlag may be set to 1 ifzigzag scanning is determined to be performed, and isZigZagScanFlag maybe set to 0 if vertical scanning is determined to be performed.Alternatively, when the partition mode of the PU is the PART_N×2N,information on a determined scanning method of horizontal scanning andzigzag scanning (or upright diagonal) scanning may be encoded using aflag, for example, isZigZagScanFlag, and the flag information may betransmitted to the decoding apparatus.

FIG. 5 illustrates a method of determining a scanning method andencoding the information thereon in asymmetric motion partition (AMP)according to an exemplary embodiment of the present invention.

As described above, a single CU of an inter prediction mode may bepartitioned into PUs with the same size or different sizes. As shown inFIG. 5, a 64×64 block may be partitioned into 16×64 block, 48×64 block,64×16 block or 64×48 block i.e. blocks of different shapes. Thispartition mode is referred to as AMP. AMP may be applied to partitioninga CU to enhance coding efficiency when a picture includes irregularimage patterns.

From left of FIG. 5, AMP includes a PART_nL×2N mode in which a CU ispartitioned into blocks with size of nL×2N 500, a PART_nR×2N mode inwhich a CU is partitioned into blocks with size of nR×2N 510, aPART_2N×nU mode in which a CU is partitioned into blocks with size of2N×nU 520, and a PART_2N×nD mode in which a CU is partitioned intoblocks with size of 2N×nD 530. Here, in the PART_nL×2N mode and thePART_nR×2N mode, a PU may have a size of ½N×2N 501 and 512 or size of3/2N×2N 502 and 511. In the PART_2N×nU mode and the PART_2N×nD, a PU mayhave a size of 2N×½N 521 and 532 or size of 2N×3/2N 522 and 531.

As described in FIG. 4, according to a embodiment of the presentinvention, a scanning method may be determined based on a partitionmode, that is, a size of a partitioned block in AMP. That is, candidatescanning methods may be obtained in view of partitioned shapes of AMP,among which a scanning method may be determined based on RDO.

For instance, for a vertically oriented block (a block that its heightis longer than its width) in the ½N×2N mode, such as a left block 501 ofnL×2N block 500 and a right block 512 of nR×2N block 510, horizontalscanning considering particular component of texture or directionalitythat the vertically oriented block may have (for example, verticalcomponent of texture and transform coefficients distributed in thehorizontal direction), or zigzag scanning (or upright diagonal scanning)considering that the vertically oriented block does not have particularcomponent of texture or directionality, may be derived as candidatescanning methods. Here, a scanning method having minimum RDO may beselected among the two candidate scanning methods.

Alternatively, for a horizontally oriented block (a block that its widthis longer than its height) in the 2N×½N mode, such as an upper block 521of 2N×nU block 520 and a lower block 532 of 2N×nD block 530, verticalscanning considering particular component of texture and directionalitythat the horizontally oriented block may have (for example, horizontaltexture or transform coefficients distributed in the verticaldirection), or zigzag scanning (or upright diagonal scanning)considering that the horizontally oriented block does not haveparticular component of texture or directionality, may be derived ascandidate scanning methods. Here, a scanning method having minimum RDOmay be selected among the two candidate scanning methods.

Meanwhile, zigzag scanning (or upright diagonal scanning) may be usedfor larger partitioned portions of nL×2N 500, nR×2N 510, 2N×nU 520 and2N×nD 530 (i.e. 3/2N×2N and 2N×3/2N modes). That is, zigzag scanning (orupright diagonal scanning) may be used for a right partition 502 ofnL×2N block 500, a left partition 512 of nR×2N block 510, a lowerpartition 522 of 2N×nU block 520 and an upper partition 531 of 2N×nDblock 530.

When a scanning method is determined based on an AMP mode as describedabove, information on the determined scanning method may be encoded. Forexample, as described above in FIG. 4, in the PART_nL×2N mode andPART_nR×2N mode and for the vertically oriented blocks 501 and 512 (i.e.the ½N×2N mode), isZigZagScanFlag may be set to 1 if zigzag scanning isused, and isZigZagScanFlag may be set to 0 if horizontal scanning isused. In the PART_2N×nU and PART_2N×nD modes and for the horizontallyoriented blocks 521 and 532 (i.e. the 2N×½N mode), isZigZagScanFlag maybe set to 1 if zigzag scanning is used and isZigZagScanFlag may be setto 0 if vertical scanning is used. Such flag information may be encodedand transmitted to the decoding apparatus.

FIG. 6 illustrates a method of determining a scanning method andencoding the information thereon in short distance intra prediction(SDIP) according to an exemplary embodiment of the present invention.

SDIP refers to a method of partitioning a CU into 2N×2N PU, N×N PU,½N×2N PU or 2N×½N PU and performing intra prediction on the partitionedPU. When SDIP is performed, a distance between a reference pixel forintra prediction and a prediction target pixel may be reduced ascompared with in conventional intra prediction performed using asquare-shaped PU. Thus a residual value that is a differential valuebetween an original pixel and the prediction target pixel (predictedpixel) decreases, resulting in an increase in encoding efficiency.

Referring to FIG. 6, one CU may be partitioned into PUs with differentsizes depending on features of a picture. For example, a 32×32 CU may bepartitioned into four 16×16 PUs 610, 620, 630 and 640. A 16×16 PU 610may be additionally partitioned into four 4×16 PUs 611, 612, 613 and614, among which a 4×16 PU 611 may be further partitioned into four 1×16PUs 611-1, 611-2, 611-3 and 611-4.

Likewise, a 16×16 PU 630 may be additionally partitioned into four 8×8PUs. A 8×8 PU 631 may be further partitioned into four 2×8 PUs 631-1,631-2, 631-3 and 631-4. Also, a 8×8 PU 632 may be further partitionedinto four 4×4 PUs, among which a 4×4 PU 632-1 may be further partitionedinto four 1×4 PUs.

As described above with reference to FIGS. 4 and 5, a scanning method isdetermined based on a partition mode of a PU in SDIP, that is, a size ofthe PU in the present embodiment. That is, candidate scanning methodsare obtained in view of partitioned shapes of PUs, among which ascanning method is determined based on RDO.

For instance, when the partition mode of the PU in SDIP is a ½N×2N modewhich has a vertically oriented partition shape such as the 4×16 PUs611, 612, 613 and 614, the 2×8 PUs 631-1, 631-2, 631-3 and 631-4 and the1×4 PU, horizontal scanning and zigzag scanning (or upright diagonalscanning) may be derived as candidate scanning methods in view ofparticular component of texture or directionality (for example, verticaltexture and transform coefficients distributed in the horizontaldirection). Here, a scanning method having minimum RDO may be selectedamong the two candidate scanning methods.

Alternatively, when the partition mode of the PU in SDIP is a 2N×½N modewhich has a horizontally oriented partition shape such as 16×4 PU, 8×2PU and 4×1 PU, vertical scanning and zigzag scanning (or uprightdiagonal scanning) may be derived as candidate scanning methods in viewof particular component of texture or directionality (for example,horizontal texture and transform coefficients distributed in thevertical direction). Here, a scanning method having minimum RDO may beselected among the two candidate scanning methods.

Information on the determined scanning method may be encoded using aflag, for example, isZigZagScanFlag, and be transmitted to the decodingapparatus, as described above in FIGS. 4 and 5.

FIG. 7 is a flowchart illustrating a video encoding method according tothe present invention. Each step of FIG. 7 may be performed bycorresponding modules of the video encoding apparatus of FIG. 1.

Referring to FIG. 7, a CU of a current picture is input to the encodingapparatus (S700). When the input CU is a CU of an inter prediction mode,the CU of the inter prediction mode (“inter CU”) may include a pluralityof PUs of the inter prediction mode (“inter PU”) and have one of twoprediction modes PreMode, a skip mode (“MODE_SKIP”) and an inter mode(“MODE_INTER”).

A CU in MODE_SKIP is not partitioned into smaller PUs any longer andallocated motion information on a PU with a partition mode PartMode ofPART_2N×2N.

A CU in MODE_INTER may be partitioned into four types of PUs, in whichinformation indicating that a prediction mode is MODE_INTER(PredMode==MODE_INTER) and information indicating which is a partitionmode among PART_2N×2N, PART_2N×N, PART_N×2N and PART_N×N (i.e.information such as PartMode==PART_2N×2N, PartMode==PART_2N×N,PartMode==PART_N×2N, or PartMode==PART_N×N) may be transmitted to thedecoding apparatus through a syntax in a CU level.

The encoding apparatus performs motion prediction for a current inter PU(S710). When the CU is partitioned into a plurality of PUs, a PU to becurrently encoded (“current PU”) is input. The encoding apparatus mayperform motion prediction for the current PU using previous frame,subsequent frame or previous and subsequent frames of a current frame.Motion information on the current PU, such as a motion vector, areference picture index and a prediction direction index, may beobtained through motion prediction.

The encoding apparatus may derive a motion prediction value of thecurrent PU in the inter prediction mode (S720). The motion informationon the current PU is not transmitted to the decoding apparatus as it isbut differential values from predicated values obtained from temporallyand spatially neighboring blocks are transmitted to the decodingapparatus so as to enhance compression efficiency. Motion predictionmethod may include a merge mode and an AMVP mode, which may be used toderive a motion prediction value.

In the merge mode, merging candidates are obtained from motioninformation on blocks temporally and spatially neighboring to thecurrent PU. When a candidate having the same motion information as thecurrent PU is present among the candidates, the encoding apparatus maytransmit a flag Merge_Flag indicating that the merge mode is used and anindex of the candidate having the same motion information as the currentPU to the decoding apparatus. In detail, the encoding apparatus derivesan available temporal motion vector predictor (MVP) value using areference picture index refldxLX indicating a reference picture obtainedin motion prediction and makes a merging candidate list MergeCandList.When a candidate having the same motion information as the current PU ispresent on the merging candidate list, the encoding apparatus setsMerge_Flag to 1 and encodes an index Merge_Idx of the candidate.

In the AMVP mode, the encoding apparatus derives AMVP candidates frommotion information on blocks temporally and spatially neighboring to thecurrent PU. That is, the encoding apparatus derives a motion vectorpredictor value mvpLX of a luma component. In detail, the encodingapparatus derives spatial motion vector candidates (MVPs) fromneighboring PUs to the current PU. The encoding apparatus derives atemporal motion vector candidate of a collocated block using a referencepicture index RefldxLX obtained in motion prediction. The encodingapparatus makes an MVP list mvpListLX based on the spatial motion vectorcandidates and the temporal motion vector candidate. When a plurality ofmotion vectors has the same value on the MVP list, the encodingapparatus removes motion vectors other than a motion vector having ahighest priority from the MVP list. Here, motion vectors may havepriories in order of motion vectors (mvLXA) of left neighboring blocksto the current PU, motion vectors (mvLXB) of upper neighboring blocks tothe current PU and a motion vector (mvLXCol) of a temporal collocatedblock, which are available. A motion vector of a best predictor amongthe motion vector candidates on the MVP list is selected as a motionvector predictive value mvpLX. The best predictor is a candidate blockminimizing a rate-distortion (RD) cost function, for example, J_(MotSAD)considering bit cost and sum of absolute difference (SAD).

The encoding apparatus encodes the motion information on the current PU(S730). When the merge mode is used for motion prediction of the currentPU, if a candidate having the same motion information as the current PUis present among merging candidates, the encoding apparatus indicatesthat the merge mode is applied to the current PU, and encodes andtransmits a flag Merge_Flag indicating that the merge mode is used andan index Merge_Idx of the candidate having the same motion informationas the current PU to the decoding apparatus.

When the AMVP mode is used for motion prediction of the current PU, theencoding apparatus determines a candidate minimizing a cost functionamong AMVP candidates by comparing motion vector information on the AMVPcandidates with motion vector information on the current PU. Theencoding apparatus performs motion compensation using the candidateminimizing the cost function and a differential value between the motioninformation on candidate minimizing the cost function and the motioninformation on current PU, thereby obtaining a residual signal. That is,the encoding apparatus may entropy-encode a motion vector differencebetween a motion vector of the current PU and the motion vector of thebest predictor.

The encoding apparatus obtains the residual signal by deriving adifference by pixels between a pixel value of the current block and apixel value of the prediction block through motion compensation (S740)and transforms the residual signal (S750).

The residual signal is encoded via transformation, in which atranscoding kernel may be used for transformation. A transcoding kernelmay have a shape of 2×2, 4×4, 8×8, 16×16, 32×32 or 64×64, among which akernel to be used for transformation may be determined in advance. Here,transform coefficients are generated by transformation and form a 2Dblock. For example, transform coefficients C for an n×n block may bederived by Equation 1.C(n,n)=T(n,n)×B(n,n)×T(n,n)^(T)  [Equation 1]

Here, C(n, n) is an n×n matrix of transform coefficients, T(n, n) is ann×n transformation kernel matrix, and B(n, n) is an n×n matrix of aresidual block.

The transform coefficients calculated by Equation 1 are quantized.

The encoding apparatus determines based on RDO which to transmit amongthe residual signal and the transform coefficients (S760). Whenprediction is properly done, the residual signal may be transmitted asit is, without transcoding. Here, the encoding apparatus may comparecost functions before/after transcoding and may select a method havingminimum costs.

The encoding apparatus may transmit a type of a signal to transmit (e.g.the residual signal or the transform coefficients), with respect to thecurrent block and transmit the signal to the decoding apparatus. Forexample, if transmitting the residual signal as it is withouttranscoding involves minimum cost, the encoding apparatus may signal theresidual signal with respect to the current block. If transmitting thetransform coefficients involves minimum cost, the encoding apparatus maysignal the transform coefficients with respect to the current block.

The encoding apparatus scans the transform coefficients (S770). Theencoding apparatus changes quantized transform coefficients of a 2Dblock form into transform coefficients of a 1D vector form by scanning.Here, one of horizontal scanning, vertical scanning and zigzag scanning(or upright diagonal scanning) may be selected based on a size of a PU,that is, a partition mode of the PU, to scan the transform coefficients.

In detail, candidate scanning modes (methods) may be derived based onpartition shapes of PUs, among which a scanning mode is determined basedon RDO. If the partition mode of the PU has a vertically orientedpartition shape, horizontal scanning and zigzag scanning (or uprightdiagonal scanning) are derived as candidate scanning modes. If thepartition mode of the PU has a horizontally oriented partition shape,vertical scanning and zigzag scanning (or upright diagonal scanning) arederived as candidate scanning modes. Then, a scanning mode havingminimum RDO is selected among the candidate scanning modes.

Here, as described above in FIGS. 4 and 6, such scanning modes may beapplied to the partition modes of the PU in inter prediction, forexample, the N×2N block, 2N×N block, 2N×2N block, N×N block, 2N×nUblock, 2N×nD block, nL×2N block and nR×2N block modes, and the partitionmodes of the PU in an intra prediction mode (e.g. short distance intraprediction: SDIP), for example, the ½N×2N block, 2N×½N block, N×N blockand 2N×2N block modes. As for this, descriptions thereof are omittedherein since already fully described before.

The encoding apparatus may entropy-encode the information to betransmitted (S780). That is, the encoding apparatus may entropy-encodethe scanned transform coefficients and information on the predictionmode. The encoded information may form a compressed bitstream and bestored or transmitted in a network abstraction layer (NAL).

FIG. 8 is a flowchart illustrating a video decoding method according tothe present invention. Each step of FIG. 8 may be performed bycorresponding modules of the video decoding apparatus of FIG. 2.

Referring to FIG. 8, the decoding apparatus may entropy-decode areceived bitstream (S800). The decoding apparatus may identify a blocktype from a variable length coding (VLC) table to recognize a predictionmode of a current block. Further, the decoding apparatus may identifyinformation on whether transmitted information on the current block is aresidual signal or transform coefficients. Depending on a result, thedecoding apparatus may obtain the residual signal or transformcoefficients for the current block.

The decoding apparatus may determine a scanning method (S810). That is,the decoding apparatus determines a scanning method based on a partitionmode of a PU using information signaled from the encoding apparatus. Thesignaled information may be a flag indicating whether zigzag scanning isused (for example, isZigZagScanFlag).

Specifically, when the partition mode of the PU has a verticallyoriented partitioned shape or horizontally oriented partitioned shape,the decoding apparatus decodes a flag indicating whether zigzag scanningis used and determines a scanning method based on a value of the decodedflag. When the partition mode of the PU has the vertically orientedpartition shape, the decoding apparatus selects one of zigzag scanningand horizontal scanning based on the value of the decoded flag. When thepartition mode of the PU has the horizontally oriented partition shape,the decoding apparatus selects one of zigzag scanning and verticalscanning based on the value of the decoded flag. For instance, zigzagscanning is used when isZigZagScanFlag is 1, while horizontal scanning(for the partition mode having the vertically oriented partitionshape)/vertical scanning (for the partition mode having the horizontallyoriented partition shape) may be used when isZigZagScanFlag is 0.

Here, as described above in FIGS. 4 and 6, such scanning methods may beapplied to the partition modes of the PU in inter prediction, forexample, the N×2N block, 2N×N block, 2N×2N block, N×N block, 2N×nUblock, 2N×nD block, nL×2N block and nR×2N block modes, and the partitionmodes of the PU in intra prediction (e.g. short distance intraprediction: SDIP), for example, the ½N×2N block, 2N×½N block, N×N blockand 2N×2N block modes. As for this, descriptions thereof are omittedherein since already fully described before.

Meanwhile, zigzag scanning may be used for a partition mode having asquare shape, such as 2N×2N block and N×N block modes, or for a rightpartition of nL×2N block mode, a left partition of nR×2N block mode, alower partition of 2N×nU block mode or an upper partition of 2N×nD blockmode as larger partitioned portions in AMP.

The decoding apparatus may inverse-scan the entropy decoded residualsignal or transform coefficients (S820). The decoding apparatus maygenerate a residual block by inverse-scanning for the case of theresidual signal and may generate a 2D transform block byinverse-scanning for the case of the transform coefficients. When thetransform block is generated, the decoding apparatus may dequantize andinverse-transform the transform block, thereby obtaining a residualblock. A process of obtaining a residual block by inverse-transforming atransform block is expressed by Equation 2.B(n,n)=T(n,n)×C(n,n)×T(n,n)^(T)  [Equation 2]

Here, B(n, n) is an n×n matrix of a residual block, T(n, n) is an n×ntransformation kernel matrix, and C(n, n) is an n×n matrix of transformcoefficients.

The decoding apparatus may perform inter prediction (S830). The decodingapparatus may decode information on the prediction mode and performinter prediction according to the prediction mode.

For example, when the prediction mode PredMode is the merge mode (forexample, PredMode==MODE_SKIP && Merge_Flag==1), the decoding apparatusmay derive a motion vector mvLX of a luma component and a referencepicture index refldxLX for the merge mode. To this end, the decodingapparatus may derive merging candidates from partitions of PUs (i.e.prediction blocks) spatially neighboring to the current PU. The decodingapparatus may derive the reference picture index refldxLX so as toobtain a temporal merging candidate for the current PU. The decodingapparatus may derive an available temporal motion vector predictor value(MVP) using the derived reference picture index. When a numberNumMergeCand of candidates on a merging candidate list MergeCandListmade based on the spatial merging candidates and the temporal mergingcandidate is 1, the decoding apparatus sets a merging candidate index(Merge_Idx) to 1. Otherwise, the decoding apparatus may set the mergingcandidate index to a received merge index. The decoding apparatusderives a motion vector (mvLX) of a merging candidate indicated by thereceived merge index and the reference picture index (refldxLX). Thedecoding apparatus may use the derived motion vector and the derivedreference picture index for motion compensation.

When the prediction mode PredMode is the AMVP mode, the decodingapparatus may derive a reference picture index (refldxLX) for thecurrent PU and may derive a motion vector predictor value (mvpLX) of aluma component using the reference picture index. In detail, thedecoding apparatus may derive spatial motion vector candidates (MVPs)from neighboring PUs to the current PU and may derive a temporal motionvector candidate (MVP) of a collocated block indicated by the referencepicture index. The decoding apparatus may generate an MVP list mvpListLXbased on the derived spatial motion vector candidates and the derivedtemporal motion vector candidate. When a plurality of motion vectors hasthe same value on the MVP list, the decoding apparatus may remove motionvectors other than a motion vector having a highest priority from theMVP list. Here, as described above, motion vectors have priories inorder of motion vector (mvLXA) of left neighboring block to the currentPU, motion vector (mvLXB) of upper neighboring block to the current PUand a motion vector (mvLXCol) of a temporal collocated block, which areavailable. When a number NumMVPCand(LX) of MVP candidates on the MVPlist is 1, the decoding apparatus may set an MPV candidate index mvpIdxto 0. When the number of MVP candidates is 2 or more, the decodingapparatus may set the MPV candidate index mvpIdx equal to a receivedindex value. The decoding apparatus may determine a motion vectorindicated by mvpIdx among the MVP candidates on the MVP list mvpListLXas a motion vector predictor value mvpLX. The decoding apparatus mayderive a motion vector mvLX using a motion vector predictor value mvpLXand Equation 3.mvLX[0]=mvdLX[0]+mvpLX[0]mvLX[1]=mvdLX[1]+mvpLX[1]  [Equation 3]

Here, mvLX[0], mvdLX[0] and mvpLX[0] are x components of an LX motionvector information (i.e. x components of mvLX, mvdLX and mvpLX), andmvLX[1], mvdLX[1] and mvpLX[1] are y components of the LX motion vectorinformation (i.e. y components of mvLX, mvdLX and mvpLX).

The decoding apparatus may derive a reconstructed signal (S840). Forinstance, the decoding apparatus may add the residual signal to a signalof a previous frame (i.e. predicted signal) to generate thereconstructed signal. The decoding apparatus may add a prediction signalof the previous frame obtained by motion compensation using a derivedmotion vector and the decoded residual signal for the current PU,thereby generating the reconstructed signal.

Although the methods have been described with a series of stages orblocks based on the flowcharts in the aforementioned embodiments, thepresent invention is not limited to the foregoing sequence of thestages. Some stages may be carried out in different order from describedabove or at the same time. Also, it will be understood by those skilledin the art that the stages illustrated in the flowcharts are notexclusive, additional stages may be included in the flowchart, or one ormore stages may be deleted from the flowcharts without affecting thescope of the present invention.

While a few exemplary embodiments have been shown and described withreference to the accompanying drawings, it will be apparent to thoseskilled in the art that various modifications and variations can be madefrom the foregoing descriptions without departing from the essence ofthe present invention. The exemplary embodiments are provided not torestrict the concept of the present invention but to illustrate thepresent invention and do not limit the scope of the present invention.The scope of the invention is defined by the appended claims, and alldifferences within the scope will be construed as being included withinthe appended claims of the present invention.

The invention claimed is:
 1. A method of decoding a video signal havinga current block to be decoded with a decoding apparatus, comprising:obtaining index information relating to the current block from the videosignal, the index information being signaled to select a collocatedpicture from a plurality of previously decoded pictures, the collocatedpicture being representative of a picture including a collocated blockwhich is used to derive a temporal motion vector candidate of thecurrent block; obtaining a spatial motion vector candidate from aspatial neighboring block of the current block; selecting, based on theindex information, the collocated picture relating to the temporalmotion vector candidate of the current block from the plurality of thepreviously decoded pictures; obtaining the temporal motion vectorcandidate from the collocated block included in the selected collocatedpicture; generating a motion vector candidate list using the spatialmotion vector candidate and the temporal motion vector candidate;deriving a motion vector predictor based on the motion vector candidatelist and a candidate index of the current block, the candidate indexspecifying one of motion vector candidates included in the motion vectorcandidate list; obtaining prediction samples of the current block byusing the motion vector predictor; obtaining residual samples relatingto the current block by performing an inverse quantization and aninverse-transform on coefficients from the video signal; andreconstructing the current block by using the prediction samples and theresidual samples, wherein the collocated picture has a temporal orderdifferent from a current picture including the current block, and thecollocated block corresponds to a position as the current block.
 2. Themethod of claim 1, wherein the spatial neighboring block includes atleast one of a left neighboring block or a top neighboring block.
 3. Themethod of claim 1, wherein the spatial motion vector candidate isarranged, in the motion vector candidate list, prior to the temporalmotion vector candidate.